package com.only4play.user.model.entity;

import com.only4play.jpa.support.entity.AggregateEntity;
import jakarta.persistence.*;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

/**
 * @author liyuncong
 * @version 1.0
 * @file UserPersonOrganizationAccountMapping
 * @brief UserPersonOrganizationAccountMapping
 * @details UserPersonOrganizationAccountMapping
 * @date 2022/4/26
 *
 * Edit History
 * ----------------------------------------------------------------------------
 * DATE                        NAME               DESCRIPTION
 * 2022/4/26                     liyuncong          Created
 */
@Entity
@Table(name = "user_person_organization_account_rel")
@Getter
@Setter
public class UserPersonOrganizationAccountRel extends AggregateEntity {
    @Id
    private String id;

    @ManyToOne(fetch = FetchType.EAGER, cascade = {CascadeType.MERGE, CascadeType.PERSIST,
        CascadeType.REFRESH})
    @JoinColumn(name = "user_person_id")
    private UserPerson person;

    @ManyToOne(fetch = FetchType.EAGER, cascade = {CascadeType.MERGE, CascadeType.PERSIST,
        CascadeType.REFRESH})
    @JoinColumn(name = "user_personal_account_id")
    private UserPersonalAccount personalAccount;

    @ManyToOne(fetch = FetchType.EAGER, cascade = {CascadeType.MERGE, CascadeType.PERSIST,
        CascadeType.REFRESH})
    @JoinColumn(name = "user_organization_id")
    private UserOrganization organization;

    @ManyToOne(fetch = FetchType.EAGER, cascade = {CascadeType.MERGE, CascadeType.PERSIST,
        CascadeType.REFRESH})
    @JoinColumn(name = "user_organization_account_id")
    private UserOrganizationalAccount organizationalAccount;
}
